UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qKfO/Rg4a2wk4+kaAnXvTDW3GRuElG2gbMZBL1FMJL0='
WHERE
key_id = 'cba3b0e6556c4509253f844e12097c4497f355c5b322ddee021104ca853f9a49'
AND (
token = 'qKfO/Rg4a2wk4+kaAnXvTDW3GRuElG2gbMZBL1FMJL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)