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