UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7vstiFTIEE5T//BpJHD18dEcfEsXs30xRUyeQ2ApQOY=' 
WHERE 
  key_id = 'a3e111ac5deb78d9f3d0a773bba470ff64c8e92259c60ff7bccc38f3e8fe7404' 
  AND (
    token = '7vstiFTIEE5T//BpJHD18dEcfEsXs30xRUyeQ2ApQOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031