UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGkxDxLwT8owt6/Gm/DoZYCeHLJA2jOGhk4OzGQxbuw=' 
WHERE 
  key_id = '3c3bc6a384194931f6823465dcf862c6c49eafd5cf9d8914bf31ee549a7493d8' 
  AND (
    token = 'pGkxDxLwT8owt6/Gm/DoZYCeHLJA2jOGhk4OzGQxbuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062