UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WFoPwa1zdPiZBzU3oTgbkiIUDfpBBQcTV6vTmU1j8tM=' 
WHERE 
  key_id = 'a5bf58bd67ce9309f8319c0a9f11b39b70b0a03cc9216623564bed3897910d06' 
  AND (
    token = 'WFoPwa1zdPiZBzU3oTgbkiIUDfpBBQcTV6vTmU1j8tM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026