UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NO79SSF2+TDb+dRTvPL8fTff2IV5J8RXABK7UIjErec=' 
WHERE 
  key_id = '7e0b17b5634061e385c6725f62b98878b9730d7d1139657f2b39461ecaac8a2e' 
  AND (
    token = 'NO79SSF2+TDb+dRTvPL8fTff2IV5J8RXABK7UIjErec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049