UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'loDsl5TIPSCFBzIbpJC6um12V/fgbEpzvYHM3sjNcwg='
WHERE
key_id = 'ea2ba3ad022fe8c166fae295830f073a3439a498f0437bbc4222562bcd498f59'
AND (
token = 'loDsl5TIPSCFBzIbpJC6um12V/fgbEpzvYHM3sjNcwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)