UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'imAfyI+sbMQbxN0QQlNRFPhUlUuSEPFsdhcnrGJJWKU='
WHERE
key_id = '04e566c30860e267ca021b4a234494019bfdbf0e1f59b1a36c94d462cb43ac04'
AND (
token = 'imAfyI+sbMQbxN0QQlNRFPhUlUuSEPFsdhcnrGJJWKU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)