UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lnxstmNII9BW1QGMAbsp77UUYZVAWSY1wzTy+suZ3cc=' 
WHERE 
  key_id = '1ecd31318651c953f598361dacd9022f0aa14f7dd62d02a825b290d1210025e0' 
  AND (
    token = 'lnxstmNII9BW1QGMAbsp77UUYZVAWSY1wzTy+suZ3cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039