UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MeGVfMd59290I1CPHeiPBpNovV+/6E1lYLl0LN1J3n4='
WHERE
key_id = 'b315f6509821ad4d756b52c31d9d8808d78dfcfb15cb61dba2bc8005596889df'
AND (
token = 'MeGVfMd59290I1CPHeiPBpNovV+/6E1lYLl0LN1J3n4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)