UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0pcgX6VLPg9vBqGnFbCIEzhSO21xLQriFfnfFOs1J+M='
WHERE
key_id = 'a78604c4b2626e2531633eeb66af422cb5d5da5445a389d07482b2220535f788'
AND (
token = '0pcgX6VLPg9vBqGnFbCIEzhSO21xLQriFfnfFOs1J+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)