UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MBkDjqTnRwN4KFfwv/oaNMayv07sZzpcOSxeeG6It1A='
WHERE
key_id = 'a6a80c659d08df24f5eb5ca0dadd632ea1dd2d87f87305f229857033863609b3'
AND (
token = 'MBkDjqTnRwN4KFfwv/oaNMayv07sZzpcOSxeeG6It1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)