UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JyPLIrPCmMbXYsNvygrmYHjiBjluWOZDdjUMVbuaiMg='
WHERE
key_id = '3fd115f19750bc75c8d7392610677cd1285a5e04c9458411e0b0c791f292138c'
AND (
token = 'JyPLIrPCmMbXYsNvygrmYHjiBjluWOZDdjUMVbuaiMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)