UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cj63h4wbolSb052FZvJd/ipADriqjXTfJ3b1QkFw7KA=' 
WHERE 
  key_id = '7da0a21701e1717500799990cafdbc037c519d301c7eaa232cad2d7fd3733908' 
  AND (
    token = 'Cj63h4wbolSb052FZvJd/ipADriqjXTfJ3b1QkFw7KA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040