UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e7NuN3A0FaqJCF++dxAf8ttTJaSe09ffthujDJcvp5M=' 
WHERE 
  key_id = '005570fbdb406a06468eb763a616fc23c9ff20630141a02c312cb562504b3819' 
  AND (
    token = 'e7NuN3A0FaqJCF++dxAf8ttTJaSe09ffthujDJcvp5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051