UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k7BBKJCWZuxxSXbUIIhC8kYURdyjy2guWV2kgO58H+M=' 
WHERE 
  key_id = '0111833f592e1178d8d2050ad07053f911aee507323aa010acee274294a63ac7' 
  AND (
    token = 'k7BBKJCWZuxxSXbUIIhC8kYURdyjy2guWV2kgO58H+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041