UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vDfqDvGcWjz8uKvNu+BLFkwEdoLtE+nzW1K9nEqKoHU='
WHERE
key_id = 'b22163130f9b4ae57f732703d8d458adf56d312b9c6aa05fdc4f12a6601df4ee'
AND (
token = 'vDfqDvGcWjz8uKvNu+BLFkwEdoLtE+nzW1K9nEqKoHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)