UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W3WZLdcQdolfePIdgi/Ox8a4h/MoUzeJ6uyXtvN6UhI=' 
WHERE 
  key_id = 'de80a547363da250977cd6e2222a5d15da2d4e1738c60e6a40e1bed86a24ff8a' 
  AND (
    token = 'W3WZLdcQdolfePIdgi/Ox8a4h/MoUzeJ6uyXtvN6UhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032