UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iElKpwdeCTVtjHmtRLAhQD7zieqUkWH0s0St7slhMbs=' 
WHERE 
  key_id = '566a0fe4e02537cec544e51259ca89bd53d7f1e03a2610f39fdc76865837db9c' 
  AND (
    token = 'iElKpwdeCTVtjHmtRLAhQD7zieqUkWH0s0St7slhMbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029