UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W7bQASynUw0UKRVtn+Bt02mk8QAiqjJe8qDgcRH3+nU=' 
WHERE 
  key_id = '8ec91f4612f203f2caf2bad9cc1fdc90656a2c9af6c20a826c38a98fac7c91cf' 
  AND (
    token = 'W7bQASynUw0UKRVtn+Bt02mk8QAiqjJe8qDgcRH3+nU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027