UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nqfRHiVRAX2kEPiaQ4r1Lx1xYxvweEQxyQmThoBsf0w='
WHERE
key_id = '94c1e869b6c54b12a70a90df526e068ad73493582dcd604685c456620b0267cc'
AND (
token = 'nqfRHiVRAX2kEPiaQ4r1Lx1xYxvweEQxyQmThoBsf0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)