UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BwM0G42PuUb+5DVAir/o5oIjZJm0+sERByK3P+s+unc='
WHERE
key_id = '1d84e341c7feeb799558cb2d4232db9c3e49bbade0e28b3c797c70161225d5e3'
AND (
token = 'BwM0G42PuUb+5DVAir/o5oIjZJm0+sERByK3P+s+unc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)