UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RvGsU7IDyWGFpjugh+EbfM6Na3rvhCRJW7NMuHMhY+M='
WHERE
key_id = 'fbaf0fb77a66f9afdabe9962d1d5a0636512d067428b2144c5ca81517a77a211'
AND (
token = 'RvGsU7IDyWGFpjugh+EbfM6Na3rvhCRJW7NMuHMhY+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)