UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9Vs92urXAVwG6Sjt6w1Vqw1eaXkHOmDrAO5QhUJvpc='
WHERE
key_id = 'f8a5dce020d8ca680d33c4a2b8d824a09e56011cc476f97e29842ff31ca17cfc'
AND (
token = 'f9Vs92urXAVwG6Sjt6w1Vqw1eaXkHOmDrAO5QhUJvpc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)