UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ofjnnXLbguDGygxDA6mK0GbAEfL+DxQ2ChXheTLzxKQ=' 
WHERE 
  key_id = 'e4ca9fc72e64107774113b71f36cf4d4bb4cc710df309a1af851921368894d21' 
  AND (
    token = 'ofjnnXLbguDGygxDA6mK0GbAEfL+DxQ2ChXheTLzxKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041