UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fKacqapNlUFUBQjAW4Wj9Ws3O+omtxcAIS/vZJcN6X0='
WHERE
key_id = '7764457df9367e161de52bc513534dc512336c3965c89b04a88f5d06c89fd82e'
AND (
token = 'fKacqapNlUFUBQjAW4Wj9Ws3O+omtxcAIS/vZJcN6X0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)