UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NNDQCvyg/0x7Rep3vZ1H6oXXKjSR3r+cCP+w3raDPEs='
WHERE
key_id = '053871e928a7176050f2d7611224068c76f004992b8e1f3790eea89f5dff01df'
AND (
token = 'NNDQCvyg/0x7Rep3vZ1H6oXXKjSR3r+cCP+w3raDPEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)