UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Zpg09ss0ahItP/agxDhJp11KTGi021TvE/oL3JDZZM=' 
WHERE 
  key_id = '4f5255896184e15035160cf9efece141a58e1f8fc4e3846f7c4d385e1509dda9' 
  AND (
    token = '0Zpg09ss0ahItP/agxDhJp11KTGi021TvE/oL3JDZZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026