UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8vtY3+Qmd92Toof1VNjRBn2isfsS3YAcDDyLRMyh4t8='
WHERE
key_id = 'c4b148566d143f9483a27629ce3b913ffff49de3ede35071a1ab7f8d19d58162'
AND (
token = '8vtY3+Qmd92Toof1VNjRBn2isfsS3YAcDDyLRMyh4t8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)