UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lKYDxk9Z+TQZ141DS01tinI2q+3FNkiREp0bsDvLFBk='
WHERE
key_id = '7e9f5540c1a48dd8c8238e3e85ba6f4032a1221e847acaa71cb809484020fce4'
AND (
token = 'lKYDxk9Z+TQZ141DS01tinI2q+3FNkiREp0bsDvLFBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)