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