UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rRKxaetmK2UqqtgG9sja46+gRKTT+r4YawM3G7VgcII=' 
WHERE 
  key_id = 'd3e73684947cd60cd4ae7143e049e2a3294abd5a8e005f9bc60cd914629e0bc7' 
  AND (
    token = 'rRKxaetmK2UqqtgG9sja46+gRKTT+r4YawM3G7VgcII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040