UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'alPHWyj8FgeNGoDDj6evSQDMOT2xk+NNr4kaJufjkrc='
WHERE
key_id = 'cc946fd80f5220008d0d201617f987c49910a071e99259a840f14bbd8ed43465'
AND (
token = 'alPHWyj8FgeNGoDDj6evSQDMOT2xk+NNr4kaJufjkrc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)