UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MZlnQ5XhpTkd2Xdm6MOrc78vW4CgX5Qx2U96bzPGOA8='
WHERE
key_id = 'dcfbe66abdb0141c514c5de87fc6d8f6cebfd3a8fb838dbc4b4e8cffb8f6ea15'
AND (
token = 'MZlnQ5XhpTkd2Xdm6MOrc78vW4CgX5Qx2U96bzPGOA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)