UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aNqlNWB6yVKqESPYRB5ls7pa9/gx+g3JeFpzc4cAdao=' 
WHERE 
  key_id = 'c657898c3cc0e7379964ed9139e7f17c694ad7b744f0df151030fb37d9469791' 
  AND (
    token = 'aNqlNWB6yVKqESPYRB5ls7pa9/gx+g3JeFpzc4cAdao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030