UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lGrLaEMTt4VfF7D91tLhbjgnMwB86njOan0Fzt3+uxI='
WHERE
key_id = 'b98de5b1ccbbd21c33e7fd42ea779afd6406c1742f85885c93f629db0125fb59'
AND (
token = 'lGrLaEMTt4VfF7D91tLhbjgnMwB86njOan0Fzt3+uxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)