UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fpC5wocZxJMKAjX2Xi7x9ONyu+tu642Y5XxOd2Nkmgk=' 
WHERE 
  key_id = 'e53305338218240d452aa1f2ca3a7d598884009680a380a40e37cde8db675740' 
  AND (
    token = 'fpC5wocZxJMKAjX2Xi7x9ONyu+tu642Y5XxOd2Nkmgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038